#!/bin/bash

BUSYBOX=/workspace/initramfs/busybox/
find $BUSYBOX ! -name 'init' -type f -exec rm -f {} + > /dev/null

mkdir -p $BUSYBOX
# cd $BUSYBOX
mkdir -p $BUSYBOX/{bin,sbin,etc,proc,sys,usr/{bin,sbin}}
cp -a /workspace/obj/busybox/_install/* $BUSYBOX/

chmod a+x $BUSYBOX/init

cd $BUSYBOX
find . -print0 \
    | cpio --null -o --format=newc \
    | gzip -9 > /workspace/obj/initramfs-busybox.cpio.gz  

#cpio -ov 中的v是verbose